package org.firebug.spring.boot.interceptor.controller;

import lombok.Data;
import lombok.experimental.Accessors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/user")
public class UserController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @RequestMapping(value = "/query/{id}", method = RequestMethod.GET)
    public User query(@PathVariable("id") Integer id) {
        logger.info("query=================");
        return new User();
    }

    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public User save(@RequestBody User user) {
        logger.info("query================={}", user);
        return user;
    }

    @Data
    @Accessors(chain = true)
    static class User {
        private String name = "felix";
    }
}
